﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SkladLib
{
    public class CenovyProfil
    {
        public int dayDif = 0;
        public string name = "";
        public string prefix = "";
        public List<int> days = new List<int>();
        public static CenovyProfil GetCenovyProfilByPrefix(string prefix)
        {
           Dictionary<string,string> row =  DataLib.Settings.databases.dbCeny.QueryGetRow("SELECT * FROM Ceny WHERE prefix='"+prefix+"'");
           return DictionaryToCenovyProfil(row);
        }

        private static CenovyProfil DictionaryToCenovyProfil(Dictionary<string, string> dictionary)
        {
            CenovyProfil profil = new CenovyProfil();
            profil.prefix = dictionary["prefix"];
            profil.name = dictionary["name"];
            profil.dayDif =int.Parse(dictionary["dayDif"]);

            for (int i = 0; i <= 6; i++)
            {
                profil.days.Add(int.Parse(dictionary["day"+i]));
            }
            return profil;
        }
    }
}
